package com.hejing.面向对象特征之三_多态.多态的测试案例;

/**
 * ClassName: Circle
 * Package: com.hejing.面向对象特征之三_多态.多态的测试案例
 * Description:
 *      圆类
 * @Author: HeJing
 * @Create: 2023-03-26 15:48
 * @Version: 1.0
 */
public class Circle extends GeometricObject{

    private double radius;  // 半径

    public Circle(String color, double weight, double radius) {
        super(color, weight);
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(int radius) {
        this.radius = radius;
    }

    // 重写父类求取面积的方法
    @Override
    public double getArea() {
        System.out.println("圆类求取面积的方法");
        return 3.14 * radius * radius;
    }
}






















